<?php
namespace app\admin\controller;
use app\app\model\Send;
use think\Db;

class Sms extends SessionCheck
{
    public function index()
    {
		$pages = pages('sms_record','',input('get.page'));
                //dump($pages);exit;
		$data =  Db::table("sms_record")->limit($pages['limit'])->order('time desc')->select();
               
        return view('',['data'  => $data,'pages' => $pages['pages'],'menu_list'=>$this->menu_list]);
    }
	
	public function setting()
    {
		if(request()->isPost()){
			$data = input("post.");
			Db::table("sms_config")->where(['id'=>1])->update($data);
		}
		$data = Db::table("sms_config")->where(['id'=>1])->find();
        return view('',['data' => $data,'menu_list'=>$this->menu_list]);
    }
	
	public function testsend()
    {
		$code = (string)rand(100000,999999);
		$Send = new Send;
		$result = $Send->sms([
			'content'  => ['code'=>$code],
			'phone'  => input('get.phone/s','','trim,strip_tags'),
		]);
		return $result;
    }

}
